1. Field of the Invention
The present invention relates to a method of providing persistence to objects in a C++ object oriented programming system.
2. Description of the Prior Art
Generally, as a method of providing persistence to objects in a C++ object oriented programming system, one of the basic methods is one which allows an user to provide persistence to program objects by calling a store request at a file system or a database for program objects to what the user wants to provide persistence. However, this method has problems in consistency in data and its use because the user has to decide the time when the objects are stored and have the responsibility of loading the stored objects for use.
In order to solve these problems, there is proposed a method by which the system automatically stores and retrieves the objects, in which an object oriented programming system and a database system are integrated therein. For automatic storage and retrieval the system must be informed of the fact that subject objects require for this work. Here, according to the method of informing this, ease of use and portability of system differ.
The method of providing persistence to C ++ objects by integrating the C++ object oriented programming system and the database system includes mainly a method by which a C++ language itself is expanded to inform permanent objects; and a method by which a persistent capable class is defined and persistence is provided to only objects of its subclass.
C++ language expansion scheme has an advantage that it can provide persistence to objects orthogonally with the type. However, the method has a problem in portability because a preprocessor or a special compiler has to be provided so as to be operable in a general C++ programming environment.
A persistent capable class library scheme has problems that type and persistence are not orthogonal each other since it provides persistence to only objects belonging to specific classes. However, it does not pose a serious problem, since there is no possibility of storing objects in a state in which the classes are not in advance modeled into the database system in real world. Also, the persistent capable class library method includes a method of turning all the objects belonging to persistence classes into permanent objects; and a method by which they are selected to be provided as persistence objects or temporary objects by the user. The method of turning all the objects belonging to persistent classes into permanent objects has a problem in flexibility since it has to create another types if it wants them as temporary objects even though they have same types.
In the persistent capable class library scheme, the facilitation of use is greatly different depending on how the permanent objects and the temporary objects can be used without being perceived. At present, a C++ binding of ODMG being a group of commercial standard which is consisted of commercial object oriented database systems vendors, has proposed a following interface by which a persistent capable class is defined and both the temporary objects and the permanent objects can be created as objects belonging to the persistent capable class.
The interface can define specific class(hereinafter referred to as "POBJECT") as a persistent capable class, allow only the objects of classes inherited from the class to become persistence objects, and also require the permanent ability when objects are created. In order for the permanent object creation request to be used as a manner of using creation operators (hereinafter called new( )) used to create C++ objects, the interface overloads the operator new( ) so that it can be provided as a method of POBJECT as follows:
1) POBJECT::new( ) // creation of temporary objects PA1 2) POBJECT::new(crowed object information, type names of objects to be created) // creation of permanent objects PA1 3) POBJECT::new(database information, type names of objects to be created) // creation of persistence or temporary objects. PA1 1) OM_POBJECT::new( ) PA1 2) OM_POBJECT::new(persistence) PA1 3) OM_POBJECT::new(persistence, type name)
In a second interface, the crowed object information to be transmitted as a parameter is one for the storage position within the database of actually created objects, in which whether the parameter exists or not determines the persistence of the object. In a third interface, the database information parameter has a persistence flag, and creates a permanent object or a temporary object according to the persistence flag. In a C++ binding of ODMG, the proposed persistent object creation interface uses the class name following a new operator to decide the type of the created object when creating a temporary object, wherein the new operator for persistent object creation requires the type name of the object to be created as a parameter.
The C++ binding of ODMG only has proposed an user interface for a method of providing persistence to C++ application programming object, and did mention nothing about any method how it should be implemented. Though there is a commercial system which is said to be compatible for this standard proposal, any internal operation algorithm or any implementation of this has not been proposed.